using System;
using DuplexTransformers;
using DuplexTransformersTests.Subjects.WorldA;
using DuplexTransformersTests.Subjects.WorldB;

namespace DuplexTransformersTests
{
    public class ProjectTransformer : ITransformer<Project, FlatProject>
    {
        public FlatProject Invoke(Project src, FlatProject current)
        {
            if (current == null) current = new FlatProject();
            current.Name = src.Name;
            current.StartedOnDateString = src.StartDateTime.ToShortDateString();
            return current;
        }

        public Project Invoke(FlatProject src, Project current)
        {
            if (current == null) current = new Project();
            current.Name = src.Name;
            current.StartDateTime = DateTime.Parse(src.StartedOnDateString);
            return current;
        }
    }
}